<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.org/ui"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:constants="http://www.tuanzi.com/constants/tags"
                xmlns:security="http://www.springframework.org/security/tags"
                template="/templates/template.xhtml">
    <ui:define name="title">推荐位编辑</ui:define>
    <ui:define name="content">
        <h:form enctype="multipart/form-data">
            <div class="topbar clearfix"
                 style="background: -webkit-linear-gradient(top,#f6f7f9 0,#ebedf0 100%);">
                <p:toolbar>
                    <f:facet name="right">
                        <p:commandButton value="编辑" icon="fa fa-edit"
                                         actionListener="#{healthHeadlineRecommendInfoBean.changeStatusToEdit}"
                                         process="@this"
                                         update="@form"
                                         rendered="#{healthHeadlineRecommendInfoBean.isView() and security:areAllGranted('LOAN_FAMILY_TAGS_FIRST_PARTY_EDIT')}"/>
                        <p:commandButton value="保存" icon="fa fa-save"
                                         actionListener="#{healthHeadlineRecommendInfoBean.onSave}"
                                         rendered="#{healthHeadlineRecommendInfoBean.isNotView() and security:areAnyGranted('LOAN_FAMILY_TAGS_FIRST_PARTY_EDIT,LOAN_FAMILY_TAGS_FIRST_PARTY_ADD')}"
                                         update="@form"/>
                        <p:commandButton value="取消" icon="fa fa-reply"
                                         actionListener="#{healthHeadlineRecommendInfoBean.changeStatusToView}"
                                         rendered="#{healthHeadlineRecommendInfoBean.isEdit()}"
                                         process="@this"
                                         update="@form"/>
                        <p:button value="返回" icon="fa fa-reply-all" href="#{currentUserBean.back}"/>
                    </f:facet>
                </p:toolbar>
            </div>
            <div class="ui-fluid" style="padding-top: 30px;">
                <div class="ui-g-12 card">
                    <div class="card">
                    	<div class="ui-g-12"><h3><b>基本信息</b></h3></div>
							<div class="ui-g-2">
                                <p:outputLabel for="articleId" value="文章标题"/>
                            </div>
                            <div class="ui-g-10">
                                <p:selectOneMenu id="articleId" value="#{healthHeadlineRecommendInfoBean.$.articleId}"
					                             filter="true"
					                             filterMatchMode="contains" disabled="#{healthHeadlineRecommendInfoBean.isView()}">
					                <f:selectItem itemLabel="- 请选择 -" itemValue=""
					                              noSelectionOption="true"/>
					                <f:selectItems value="#{healthHeadlineRecommendInfoBean.articleList}" var="ar"
					                               itemLabel="#{ar.title}" itemValue="#{ar.id}"/>
					            </p:selectOneMenu>
                            </div>
							<div class="ui-g-2">
                                <p:outputLabel for="weight" value="权重"/>
                            </div>
                            <div class="ui-g-4">
                                <p:inputText id="weight" value="#{healthHeadlineRecommendInfoBean.$.weight}"
                                             disabled="#{healthHeadlineRecommendInfoBean.isView()}"/>
							</div>
							<div class="ui-g-2">              
                                <p:outputLabel for="advertiseStatus" value="广告位状态"/>
                            </div>
                            <div class="ui-g-4">
						        <p:selectOneRadio id="advertiseStatus" value="#{healthHeadlineRecommendInfoBean.$.advertiseStatus}"
					                               disabled="#{healthHeadlineRecommendInfoBean.isView()}">
					                <f:selectItem itemLabel="未上线" itemValue="0"/>
                                   	<f:selectItem itemLabel="已上线" itemValue="1"/>
						        </p:selectOneRadio>
						    </div>
						    <div class="ui-g-2"> 
						        <p:outputLabel for="advertiseOnlineDate" value="广告位上线时间"/>
						    </div>
                            <div class="ui-g-4">
                            	<p:calendar id="advertiseOnlineDate" value="#{healthHeadlineRecommendInfoBean.$.advertiseOnlineDate}"
                            	 			disabled="#{healthHeadlineRecommendInfoBean.isView()}"
                                            locale="#{constants:get('LOCALE')}"
                                            timeZone="#{constants:get('TIME_ZONE')}"
                                            pattern="#{constants:get('DATETIME_FORMAT')}"/>
                            </div>
                            <div class="ui-g-2"> 
						        <p:outputLabel for="advertiseOfflineDate" value="广告位下线时间"/>
						    </div>
                            <div class="ui-g-4">
                            	<p:calendar id="advertiseOfflineDate" value="#{healthHeadlineRecommendInfoBean.$.advertiseOfflineDate}"
                            	 			disabled="#{healthHeadlineRecommendInfoBean.isView()}"
                                            locale="#{constants:get('LOCALE')}"
                                            timeZone="#{constants:get('TIME_ZONE')}"
                                            pattern="#{constants:get('DATETIME_FORMAT')}"/>
                            </div>
                            <div class="ui-g-12"><h3><b>作用小程序（多选）</b></h3></div>
						    <div class="ui-g-12">
					            <p:selectManyButton value="#{healthHeadlineRecommendInfoBean.$.selectedMiniAppsList}"
					                                disabled="#{healthHeadlineRecommendInfoBean.isView()}">
					                <f:selectItems value="#{healthHeadlineRecommendInfoBean.allMiniAppsList}"
					                               var="apps"
					                               itemLabel="#{apps.relationName}"
					                               itemValue="#{apps.id}"/>
					            </p:selectManyButton>
					        </div>
					        
                            <div class="ui-g-12"><h3><b>推荐位</b></h3></div>
                            <div class="ui-g-12">
					            <p:selectOneButton value="#{healthHeadlineRecommendInfoBean.$.advertiseId}"
					                                disabled="#{healthHeadlineRecommendInfoBean.isView()}">
					                <f:selectItems value="#{healthHeadlineRecommendInfoBean.advertiseList}"
					                               var="apps"
					                               itemLabel="#{apps.relationName}"
					                               itemValue="#{apps.id}"/>
					            </p:selectOneButton>
					        </div>
                    </div>
                </div>
            </div>
        </h:form>
        
    </ui:define>
</ui:composition>











